home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / pmake / customs / customsInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-15  |  4.4 KB  |  129 lines

  1. /*-
  2.  * customsInt.h --
  3.  *    Definitions internal to the customs daemon.
  4.  *
  5.  * Copyright (c) 1988, 1989 by the Regents of the University of California
  6.  * Copyright (c) 1988, 1989 by Adam de Boor
  7.  * Copyright (c) 1989 by Berkeley Softworks
  8.  *
  9.  * Permission to use, copy, modify, and distribute this
  10.  * software and its documentation for any non-commercial purpose
  11.  * and without fee is hereby granted, provided that the above copyright
  12.  * notice appears in all copies.  The University of California,
  13.  * Berkeley Softworks and Adam de Boor make no representations about
  14.  * the suitability of this software for any purpose.  It is provided
  15.  * "as is" without express or implied warranty.
  16.  *
  17.  *    "$Id: customsInt.h,v 1.19 89/11/14 13:46:28 adam Exp $ SPRITE (Berkeley)"
  18.  */
  19. #ifndef _CUSTOMSINT_H_
  20. #define _CUSTOMSINT_H_
  21.  
  22. #include    "sprite.h"
  23. #include    "customs.h"
  24. #include    <sys/time.h>
  25. #include    <arpa/inet.h>
  26.  
  27. typedef struct {
  28.     struct in_addr    addr;          /* The address of the host */
  29.     struct timeval    interval;   /* If the master doesn't get another
  30.                      * avail packet after this interval,
  31.                      * the host will be considered down */
  32.     long           avail;        /* 0 if available. One of the AVAIL_*
  33.                      * constants if not */
  34.     long                rating;        /* Availability index (high => better) */
  35. } Avail;
  36.  
  37. typedef struct {
  38.     long           avail;        /* 0 if available. One of the AVAIL_*
  39.                      * constants if not */
  40.     long                rating;        /* Availability index (high => better) */
  41. } AllocReply;
  42.  
  43. #define MAX_REG_SIZE        1024
  44.  
  45. #define CUSTOMSINT_RETRY    2
  46. #define CUSTOMSINT_URETRY   500000
  47. #define CUSTOMSINT_NRETRY   3
  48.  
  49. /*
  50.  * EXTERNAL DECLARATIONS
  51.  */
  52.  
  53. #define Local(sinPtr) Rpc_IsLocal((sinPtr))
  54.  
  55. /*
  56.  * customs.c:
  57.  */
  58. extern char               localhost[];    /* Name of this machine */
  59. extern struct sockaddr_in   localAddr;        /* Real internet address of
  60.                          * udp socket (i.e. not 127.1) */
  61. extern struct timeval        retryTimeOut;   /* Timeout for each try */
  62. extern Boolean              amMaster;        /* TRUE if acting as the MCA */
  63. extern Boolean              verbose;        /* TRUE if should print lots of
  64.                          * messages */
  65. extern int                udpSocket;        /* Socket we use for udp rpc
  66.                          * calls and replies */
  67. extern short                udpPort;        /* Local customs UDP service port*/
  68. extern int                tcpSocket;        /* Service socket for handing tcp
  69.                          * rpc calls. */
  70. extern short                tcpPort;        /* Local TCP service port */
  71. extern char               *regPacket;        /* Our registration packet */
  72. extern int                regPacketLen;   /* The length of it */
  73. extern int                numClients;        /* Number of clients we support */
  74. extern char               **clients;        /* Names of clients we support */
  75. extern unsigned long        arch;           /* Architecture code */
  76.  
  77. /*
  78.  * avail.c:
  79.  */
  80. void                      Avail_Init();   /* Initialize availability module*/
  81. Boolean                      Avail_Send();   /* Send an availability packet to
  82.                          * the master */
  83. int                      Avail_Local();  /* Check local availability */
  84. extern int                  avail_Bias;        /* Bias for availability "rating"*/
  85. /*
  86.  * import.c:
  87.  */
  88. void                      Import_Init();  /* Initialize importation */
  89. int                      Import_NJobs(); /* Return the number of active */
  90.                         /* imported jobs */
  91.  
  92. /*
  93.  * mca.c:
  94.  */
  95. void                      MCA_Init();        /* Set up to act as master */
  96. void                      MCA_Cancel();   /* Cancel mastery */
  97. void                      MCA_HostInt();  /* Process an internal Host req */
  98.  
  99. /*
  100.  * election.c
  101.  */
  102. void                      Elect_Init();       /* Initialization */
  103. void                      Elect_GetMaster();    /* Find MCA */
  104. Boolean                      Elect_InProgress();    /* See if an election is going
  105.                          * on. */
  106. extern struct sockaddr_in   masterAddr;     /* Address of master's socket */
  107. extern long            elect_Token;    /* Token to pass during
  108.                          * elections */
  109.  
  110. /*
  111.  * log.c
  112.  */
  113. void                      Log_Init();
  114. void                      Log_Send();
  115.  
  116. /*
  117.  * swap.c
  118.  */
  119. extern void               Swap_Timeval();      /* struct tv */
  120. extern void            Swap_Avail();        /* Avail_Data */
  121. extern void            Swap_AvailInt();     /* Avail */
  122. extern void            Swap_Host();           /* Host_Data */
  123. extern void            Swap_ExportPermit();/* ExportPermit */
  124. extern void            Swap_WayBill();      /* WayBill */
  125. extern void            Swap_Kill();    /* Kill_Data */
  126. extern void            Swap_RegPacket();    /* reg packet (free-form) */
  127. extern void            Swap_Info();        /* Info packet (free-form) */
  128. #endif _CUSTOMSINT_H_
  129.